// 导入Vue
import Vue from 'vue';
// 导入vue-router
import VueRouter from 'vue-router';
// 将vue-router注册成Vue的插件
Vue.use(VueRouter);


// 导入路由组件
import Login from './pages/Login';
import Layout from './Layout';
// 导入菜单组件
import MenuList from './pages/menu/List';
import MenuAdd from './pages/menu/Add';
import MenuEdit from './pages/menu/Edit';
// 角色管理组件
import RoleList from './pages/role/List';
import RoleAdd from './pages/role/Add';
import RoleEdit from './pages/role/Edit';
// 管理员管理
import Admin from './pages/admin/List';
import AdminAdd from './pages/admin/Add';
import AdminEdit from './pages/admin/Edit';

// 商品分类
import CateList from './pages/category/List';
import CateAdd from './pages/category/Add';
import CateEdit from './pages/category/Edit';

// 商品规格
import Specs from './pages/specs/List';
import SpecsAdd from './pages/specs/Add';
import SpecsEdit from './pages/specs/Edit';

// 商品管理
import Goods from './pages/goods/List';
import GoodsEdit from './pages/goods/Edit';
import GoodsAdd from './pages/goods/Add';


// 1-定义路由规则表
const routes = [
    {
        path: '/login',
        component: Login
    },
    {
        path: '/',
        component: Layout,
        children: [
            {
                path: '/menu',
                component: MenuList
            },
            {
                path: '/menu/add',
                component: MenuAdd
            },
            {
                path: '/menu/:id',
                component: MenuEdit
            },
            {
                path: '/role',
                component: RoleList
            },
            {
                path: '/role/add',
                component: RoleAdd
            },
            {
                path: '/role/:id',
                component: RoleEdit
            },
            {
                path: '/admin',
                component: Admin
            },
            {
                path: '/admin/add',
                component: AdminAdd
            },
            {
                path: '/admin/:id',
                component: AdminEdit
            },
            {
                path: '/category',
                component: CateList
            },
            {
                path: '/category/add',
                component: CateAdd
            },
            {
                path:'/category/:id',
                component:CateEdit
            },
            {
                path:'/specs',
                component:Specs
            },
            {
                path:'/specs/add',
                component:SpecsAdd
            },
            {
                path:'/specs/:id',
                component:SpecsEdit
            },
            {
                path:'/goods',
                component:Goods
            },
            {
                path:'/goods/add',
                component:GoodsAdd
            },
            {
                path:'/goods/:id',
                component:GoodsEdit
            },
            
            
            
        ]
    }
];

// 2-创建路由对象
const router = new VueRouter({
    routes
});

// 3-导出路由实例对象
export default router;